<div class="modal-panel">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
					&times;
				</button>
				<h4 class="modal-title">
					角色新增
				</h4>
			</div>
			<div class="modal-body">
				<form class="createform">
				<input type='hidden' name='save' value='1'>
				<div class="line">
					<div class="left-48 input-group">
						<span class="input-group-addon">角色名称</span>
						<input type="text" class="form-control" rule='{"nn":1,"mn":3,"mx":16,"rv":{"pr":"admin:role:uniqname"}}' name="role_name" placeholder="必填，3-16个汉字以内">
					</div>
					<div class="right-48  input-group">
						<span class="input-group-addon">角色标识</span>
						<input type="text" class="form-control" rule='{"nn":1,"mn":3,"mx":16,"rv":{"pr":"admin:role:uniqname"}}' name="role_sign" placeholder="必填，3-16个字符或汉字">
					</div>
				</div>
				<div class="line">
					<div class="input-group">
						<span class="input-group-addon">备注</span>
						<div class="ta-outline"><textarea rows="3" rule='{"mx":500}' name="remark"></textarea></div>
					</div>
				</div>
			</form>
			</div>
			<div class="modal-footer">
				<button type="reset" class="btn btn-default">重置</button>
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary" >提交</button>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal -->

<script>
$(document).ready(function(){
	m = getMenuByPermit('admin:role:add');
	if(!m){$("#roleI").remove();}
	getData(m.url);

	$("#roleI .createform").formValidation(); 

	$("#roleI button.btn-primary").on('click',function(){
		 _p = $(this).getParentTab();
		 m = getMenuByPermit('admin:role:add');
		 if(m){
			getData(m.url,$("#roleI .createform").serialize(),
			function(res){
				if(res.code==RESP_SUCCESS){
					messageBox(res.msg,'角色新增结果',
					function(){
						$("#roleI").modal('hide');
						m = getMenuByPermit('admin:role');
						getData(m.url,_p.find("div.searchbar form").serialize(),
							function(res){
								_p.fillListData(res);
							});
					});
				}else {
					messageBox(res.msg,'角色新增结果');
				}
			});
		}
			
	});
});
</script>
